let fs = require("fs");

let fileName = './1.txt';

fs.exists(fileName, function(result) {
    if(result) {
        fs.readFile(fileName, function(err, data) {
            console.log(data.toString());
        })
    } else {
        fs.writeFile(fileName,'this is 1.txt', function(error) {
            if(error) {
                console.log("文件写入失败");
            } else {
                console.log("文件写入成功");
            }
        })
    }
})

let promise = new Promise(function(resolve, reject) {
    setTimeout(() => {
            resolve('成功状态');
    }, 200);
})
